import type { ThemeMode, ThemeVariables } from "@/types/theme";

// 默认亮色主题变量
export const defaultLightTheme: ThemeVariables = {
	// 主色系
	primaryColor: "#2E8B57",
	primaryColorLight: "#5FAB75",
	primaryColorDark: "#285430",

	// 文字颜色
	textPrimary: "#303133",
	textRegular: "#606266",
	textSecondary: "#909399",
	textPlaceholder: "#C0C4CC",

	// 边框颜色
	borderColor: "#DCDFE6",
	borderColorLight: "#E4E7ED",
	borderColorDark: "#D4D7DE",

	// 背景颜色
	bgColor: "#F5F7FA",
	bgColorLight: "#FFFFFF",
	bgColorDark: "#EBEEF5",

	// 功能色
	successColor: "#67C23A",
	warningColor: "#E6A23C",
	dangerColor: "#F56C6C",
	infoColor: "#909399",
};

// 默认暗色主题变量
export const defaultDarkTheme: ThemeVariables = {
	// 主色系
	primaryColor: "#5FAB75",
	primaryColorLight: "#7BC08F",
	primaryColorDark: "#2E8B57",

	// 文字颜色
	textPrimary: "#E5EAF3",
	textRegular: "#CFD3DC",
	textSecondary: "#A3A6AD",
	textPlaceholder: "#8D9095",

	// 边框颜色
	borderColor: "#4C4D4F",
	borderColorLight: "#363637",
	borderColorDark: "#58585B",

	// 背景颜色
	bgColor: "#1D1E1F",
	bgColorLight: "#2B2B2D",
	bgColorDark: "#18181A",

	// 功能色
	successColor: "#67C23A",
	warningColor: "#E6A23C",
	dangerColor: "#F56C6C",
	infoColor: "#909399",
};

export interface ThemeState {
	mode: ThemeMode;
	variables: ThemeVariables;
	systemIsDark: boolean;
}

export const state = (): ThemeState => ({
	mode: "light",
	variables: defaultLightTheme,
	systemIsDark: window.matchMedia("(prefers-color-scheme: dark)").matches,
});
